<template lang="pug">
  div#home
    div#menu
      div(class="btn-border-light" :class="{active:isActive===index}" v-for="(item,index) in menus" :key="index" @click="openMenu(index)")
        span {{item}}
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";

@Component({
    components: {}
})
export default class Home extends Vue {
    private menus: string[] = ["开始剧情", "快速游戏", "关于我们", "退出游戏"];
    private isActive: number = -1;
    private openMenu(index: number) {
        this.isActive = index;
        if (index === 1) {
            setTimeout(() => {
                this.$router.push({ path: "/game" });
            }, 200);
        }
    }
}
</script>

<style lang="scss" scoped>
%curios {
    cursor: pointer;
}
#home {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 30px;
    width: 100%;
    height: 100%;
}

#menu {
    display: flex;
    flex-direction: column;
    & > div {
        color: #3971c5;
        -webkit-animation: hue 6s infinite linear;
        margin-bottom: 24px;
        padding: 4px;
        @extend %curios;
    }
}
@keyframes hue {
    0% {
        color: #3971c5;
    }
    50% {
        color: #4317bd;
    }
    100% {
        color: #3971c5;
    }
}
.btn-border-light {
    border: 1px solid;
    overflow: hidden;
    position: relative;
    border: 0 solid;
    outline: 2px solid;
    outline-color: rgba(57, 113, 197, 0.5);
    outline-offset: 2px;
    text-shadow: none;
    transition: all 1250ms cubic-bezier(0.19, 1, 0.22, 1);
    & span {
        z-index: 20;
    }
    &:after {
        background: #fff;
        content: "";
        height: 155px;
        left: -75px;
        opacity: 0.2;
        position: absolute;
        top: -50px;
        -webkit-transform: rotate(35deg);
        -ms-transform: rotate(35deg);
        transform: rotate(35deg);
        -webkit-transition: all 550ms cubic-bezier(0.19, 1, 0.22, 1);
        transition: all 550ms cubic-bezier(0.19, 1, 0.22, 1);
        width: 50px;
        z-index: -10;
    }

    &:hover:after {
        left: 120%;
        -webkit-transition: all 550ms cubic-bezier(0.19, 1, 0.22, 1);
        transition: all 550ms cubic-bezier(0.19, 1, 0.22, 1);
    }
}
.active {
    outline-color: rgba(57, 113, 197, 0);
    outline-offset: 15px;
    text-shadow: 1px 1px 2px #1298d1;
}
</style>

